<!--
 * @Description: 车辆外包
 * @Autor: wangwangwang
 * @Date: 2021-01-28 20:05:18
 * @LastEditors: wangwangwang
 * @LastEditTime: 2021-08-10 16:25:55
-->
<template>
  <div class="table car">
    <div class="card">
      <div class="card_nav">
        <div>
          <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='TIANJIA'))!==-1" size="small" class="bottom_all" style="margin-left: 0" @click="addFromDate('添加'), reset()">
            <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
            添加
          </el-button>
          <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='RIYONG'))!==-1" size="small" class="bottom_three" @click="UpdateOrDelete('update_enable', 1)">
            <i class="icon iconfont iconicon_button_startuse" style="font-size: 12px"></i>
            启用
          </el-button>
          <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='JINYONG'))!==-1" size="small" class="bottom_four" @click="UpdateOrDelete('update_enable', 0)">
            <i class="icon iconfont iconicon_button_disable1" style="font-size: 12px"></i>
            禁用
          </el-button>
          <el-button v-if="ButtonList.some(res=>(res.buttonValue=='TIAOJIA'))" size="small" class="botton_five" :disabled="yiFenPeiRadio == ''" @click="riseInPriceQueryOneByidFun(yiFenPeiRadio)">调价</el-button>
          <el-button v-if="ButtonList.some(res=>(res.buttonValue=='KAIHUXINXI'))" size="small" class="botton_five" :disabled="yiFenPeiRadio == ''" @click="queryListsByPidFun(yiFenPeiRadio)">开户信息</el-button>
          <el-button v-if="ButtonList.some(res=>(res.buttonValue=='FENPEIZHANGHAO'))" size="small" class="botton_five" :disabled="yiFenPeiRadio == ''" @click="open(yiFenPeiRadio,'dialog1')">分配账号</el-button>
        </div>
        <div>
          <el-dropdown :hide-on-click="false" trigger="click" style="margin: 0 20px">
            <el-link :underline="false">
              <span class="el-icon--left">
                <i class="iconfont iconicon_button_filtrate"></i>
              </span>
              筛选
            </el-link>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-for="(item, index) in table" :key="index">
                <el-checkbox v-model="item.status">{{
                  item.label
                  }}</el-checkbox>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-link :underline="false" @click="load()">
            <span class="el-icon--left">
              <i class="iconfont iconicon_button_export1"></i>
            </span>
            导出
          </el-link>
        </div>
      </div>
      <div v-loading="tableLoading" class="card_info">
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55">
            <template slot-scope="scope">
              <el-radio v-model="yiFenPeiRadio" :label="scope.row">{{""}}</el-radio>
            </template>
          </el-table-column>
          <template v-for="(item, index2) in table">
            <el-table-column v-if="item.label == '操作'" :key="index2" fixed="right" :label="item.label" align="center" :width="item.width">
              <template slot-scope="scope">
                <el-dropdown :hide-on-click="false" trigger="click">
                  <el-button size="mini" class="bottom_one">更多</el-button>
                  <el-dropdown-menu slot="dropdown" style="text-align: left">
                    <el-dropdown-item v-if="ButtonList.some(res=>(res.buttonValue=='XIUGAI'))">
                      <el-button style="margin:5px 0" class="bottom_one" size="mini" @click="contractQueryDetailByIdFun(scope.row.id),addDialogTitle='修改',modifyType = false">
                        修改
                      </el-button>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-button size="mini" style="margin:5px 0" class="bottom_one" @click="$refs.ModifyTheRecord.contractQueryPageContractLogFun(scope.row.id)">更改记录</el-button>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column v-else-if="item.status" :key="index2" :label="item.label" align="center" :width="item.width">
              <template slot-scope="scope">
                <div v-if="item.label == '状态'">
                  <span v-if="scope.row.enable == 0" style="color: #969799">禁用</span>
                  <span v-else-if="scope.row.enable == 1" style="color: #00a754">启用</span>
                </div>
                <el-link v-else-if="item.label == '合同ID'" class="table_link" :underline="false" @click="contractQueryDetailByIdFun(scope.row.id),addDialogTitle='查看'">{{scope.row.code}}</el-link>
                <div v-else-if="item.label == '站点名称'">
                  <span v-if="scope.row.cargoTypeId == 1||scope.row.cargoTypeId == 2">{{scope.row.stations|stationsFun }}</span>
                  <span v-else></span>
                </div>
                <div v-else-if="item.label == '合同签订情况'">
                  <span v-if="scope.row.concludeAndSignStatus == 1">已签订</span>
                  <span v-else>未签订</span>
                </div>
                <div v-else-if="item.label == '华西云采注册情况'">
                  <span v-if="scope.row.loginStatus == 1">已注册</span>
                  <span v-else>未注册</span>
                </div>
                <div v-else-if="item.label == '合同有效期'">
                  {{ scope.row.startDay + " - " + scope.row.endDay }}
                </div>
                <span v-else-if="item.label == '合同有效期'" style="color: #969799">{{ scope.row.contractBeginTime }} --
                  {{ scope.row.contractEndTime }}</span>
                <span v-else>{{ scope.row[item.prop] }}</span>
              </template>
            </el-table-column>
          </template>
        </el-table>
      </div>
      <div class="card_bottom">
        <div class="card_bottom_left">
          <div class="top_page_totle">总共{{ total }}条</div>
          <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" :page-sizes="[10, 20, 30, 40,50,100,200,500,1000]" layout="prev,pager,sizes,next,jumper" :total="total" @size-change="sizeChange" @current-change="gettableData(),yiFenPeiRadio=''"></el-pagination>
        </div>
        <div>
          <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
        </div>
      </div>
    </div>
    <!-- 添加·合同 -->
    <el-dialog v-dialogDrag :visible.sync="addDialog" width="1015px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">{{ addDialogTitle }}</span>
      <div class="dialoginfo FZYform scroll" style="height: calc(85vh - 230px);padding-right:5px;overflow: auto;">
        <el-form ref="reffromDate" :rules="rules" :inline="true" :model="formDate" label-width="110px">
          <div class="form-title">基本信息</div>
          <el-form-item>
            <span slot="label">合同类型</span>
            <div style="width: 310px">{{ formDate.contractType }}</div>
          </el-form-item>
          <el-form-item prop="firstPartyId">
            <span slot="label">权限公司</span>
            <el-select ref="selection1" v-model="formDate.firstPartyId" placeholder="请选择" :disabled="modifyType" @change="companylistChangeFun(true,formDate.firstPartyId),$nextTick(()=>{formDate.firstParty = $refs.selection1.selectedLabel})">
              <el-option v-for="(item, index) in companylist" :key="index" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="contractSigningSubjectId">
            <span slot="label">合同签订主体</span>
            <el-select ref="selection1" v-model="formDate.contractSigningSubjectId" placeholder="请选择" :disabled="modifyType" @change="$nextTick(()=>{formDate.contractSigningSubject = $refs.selection1.selectedLabel})">
              <el-option v-for="(item, index) in roadWorkList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :key="formDate.firstPartyId" prop="stationsList">
            <span slot="label">站点名称</span>
            <el-select v-model="formDate.stationsList" :placeholder="formDate.stationsPlaceholder" multiple :disabled="modifyType" @change="stationsListFun()">
              <el-option v-for="(item, index)  in sitelist" :key="index" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="supplierId">
            <span slot="label">主合同单位</span>
            <el-select v-model="formDate.supplierId" filterable placeholder="请选择" style="width: 340px" :disabled="modifyType" @change="changemainCompanyId(formDate.supplierId)">
              <el-option v-for="(item, index)  in supplierList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <span slot="label">供应商类别</span>
            <div style="width: 340px">{{ formDate.supplierType }}</div>
          </el-form-item>
          <el-form-item prop="contractNumber">
            <span slot="label">合同编号</span>
            <el-input v-model="formDate.contractNumber" placeholder="请输入" clearable :disabled="modifyType" @blur="queryContractNumberFun()"></el-input>
          </el-form-item>
          <el-form-item prop="callForBidsNumber">
            <span slot="label">招标编号</span>
            <el-input v-model="formDate.callForBidsNumber" placeholder="请输入" clearable :disabled="modifyType"></el-input>
          </el-form-item>
          <el-form-item prop="concludeAndSignStatus">
            <span slot="label">合同签订情况</span>
            <el-select v-model="formDate.concludeAndSignStatus" placeholder="请选择" :disabled="modifyType">
              <el-option label="已签订" :value="1"></el-option>
              <el-option label="未签订" :value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="loginStatus" label-width="140px">
            <span slot="label">华西云采注册情况</span>
            <el-select v-model="formDate.loginStatus" class="hyyc" placeholder="请选择" :disabled="modifyType">
              <el-option label="已注册" :value="1"></el-option>
              <el-option label="未注册" :value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="linkman">
            <span slot="label">联系人</span>
            <el-input v-model="formDate.linkman" placeholder="请输入" clearable :disabled="modifyType"></el-input>
          </el-form-item>
          <el-form-item prop="phone">
            <span slot="label">联系电话</span>
            <el-input v-model="formDate.phone" placeholder="请输入" clearable :disabled="modifyType"></el-input>
          </el-form-item>
          <div>
            <el-form-item prop="startDayendDay">
              <span slot="label">合同有效期</span>
              <el-date-picker v-model="formDate.startDayendDay" unlink-panels style="width:340px;" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期" :disabled="modifyType"></el-date-picker>
            </el-form-item>
          </div>
          <div class="form-title">运输货物、到岸地及单价</div>
          <el-form-item prop="cargoTypeId">
            <span slot="label">货物类型</span>
            <el-select v-model="formDate.cargoTypeId" placeholder="请选择" :disabled="modifyType" @change="cargoTypeIdFun()">
              <el-option v-for="(item, index) in cargoTypeIdArr" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="formDate.cargoTypeId == 1" prop="cargoId">
            <span slot="label">运输货物</span>
            <el-select ref="cargo" v-model="formDate.cargoId" placeholder="请选择" :disabled="modifyType" @change="getRawContractsByRawIdFun(),$nextTick(()=>{formDate.cargo = $refs.cargo.selectedLabel})">
              <el-option v-for="(item, index) in MaterialsList" :key="index" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <div v-if="formDate.cargoTypeId == 1">
            <div style="padding-bottom: 10px">
              <el-button size="mini" class="bottom_all" style="margin-left: 0" :disabled="modifyType" @click="addItem()">
                <i class="icon iconfont iconicon_button_add" style="font-size: 12px"></i>
                添加
              </el-button>
            </div>
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="cplistArr" tooltip-effect="dark" class="FZYselectList" :span-method="objectSpanMethod">
              <el-table-column label="原物料合同" align="center" width="120">
                <template slot-scope="scope">
                  <span v-if="scope.row.contractNo" class="table_link" style="cursor:pointer;" @click="ListChoiceTypeFun(scope.$index,scope.row.contractId)">{{scope.row.contractNo}}</span>
                  <span v-else class="table_link" style="cursor:pointer;" @click="ListChoiceTypeFun(scope.$index)">选择</span>
                </template>
              </el-table-column>
              <el-table-column label="物料名称" align="center" prop="productName"></el-table-column>
              <el-table-column label="货物品牌" align="center" prop="brand"></el-table-column>
              <el-table-column label="规格" align="center" prop="specification"></el-table-column>
              <el-table-column label="起运地" align="center" width="180">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.startAddress" size="mini" style="width: 100%" placeholder="输入起运地" :disabled="modifyType" />
                </template>
              </el-table-column>
              <el-table-column label="到岸地价格（元/吨）" align="center">
                <el-table-column v-for="(v, k) in formDate.carVo.list" :key="k" width="200">
                  <template slot="header" slot-scope="scope">
                    <el-select :ref="scope.row" v-model="v.stationId" size="mini" placeholder="选择站点" :disabled="modifyType" @change="stationId_NameFun(k, v.stationId)">
                      <el-option v-for="(item, index3) in sitelist" :key="index3" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                    <el-button v-if="formDate.carVo.list.length == k + 1" class="bottom_all_two" :disabled="modifyType" @click="addHeader(k)">添加</el-button>
                    <el-button v-else class="bottom_all_two" :disabled="modifyType" @click="delHeader(k)">删除</el-button>
                  </template>
                  <template slot-scope="scope">
                    <el-input v-for="(v2, k2) in scope.row.list" v-show="k2 == k" :key="k2" v-model="v2.money" type="Number" size="mini" style="width: 100%" placeholder="输入价格" :disabled="modifyType" />
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="操作" align="left" prop="specification" fixed="right">
                <template slot-scope="scope">
                  <el-button size="mini" class="bottom_two" :disabled="modifyType" @click="deleteItem(scope.$index)">
                    <i class="icon iconfont iconicon_button_delete" style="font-size: 12px"></i>
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div v-if="formDate.cargoTypeId == 2" class="FZY1-3">
            <el-tabs v-if="tabsArr.length>0" v-model="editableTabsValue" type="border-card" style="margin-bottom:10px;">
              <el-tab-pane v-for="(item,k) in tabsArr" :key="k" :label="item.stationName">
                <div v-for="(v3, k3) in item.list" v-show="tabsArr.length>0" :key="k3">
                  <div v-if="k3 == 0" class="liBox1">
                    <div>
                      <span>小于</span>
                      <el-input-number v-model="v3.singleMaxDistance" size="mini" :controls="false" :precision="2" :disabled="modifyType" @blur="inpuSizeCheck(v3.singleMaxDistance,k3,item.list)"></el-input-number>
                    </div>
                    <div>
                      <span>千米</span>
                      <b>：</b>
                      <el-input-number v-model="v3.singleDistancePrice" size="mini" :controls="false" :min="0" :disabled="modifyType"></el-input-number>
                      <span>元/方</span>
                    </div>
                    <div>
                      <span>运输系数</span>
                      <el-input-number v-model="v3.coefficient" size="mini" :disabled="modifyType" :controls="false"></el-input-number>
                    </div>
                  </div>
                  <div v-if="k3 > 0 && k3 != item.list.length - 1" class="liBox3">
                    <div>
                      <div>
                        <el-input-number v-model="v3.singleMinDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
                        <span>至</span>
                        <el-input-number v-model="v3.singleMaxDistance" size="mini" :controls="false" :precision="2" :disabled="modifyType" @blur="inpuSizeCheck(v3.singleMaxDistance,k3,item.list)"></el-input-number>
                      </div>
                      <div>
                        <span>千米</span>
                        <b>：</b>
                        <el-input-number v-model="v3.singleDistancePrice" size="mini" :controls="false" :min="0" :disabled="modifyType"></el-input-number>
                        <span>元/方</span>
                      </div>
                      <div>
                        <span>运输系数</span>
                        <el-input-number v-model="v3.coefficient" size="mini" :disabled="modifyType" :controls="false"></el-input-number>
                      </div>
                    </div>
                    <div>
                      <el-button v-if="item.list.length - 2 == k3" class="bottom_text" :disabled="modifyType" @click="addJsonList()">添加区间</el-button>
                      <el-button v-else class="bottom_text" :disabled="modifyType" @click="delJsonList(k3)">删除区间</el-button>
                    </div>
                  </div>
                  <div v-if="k3 == item.list.length - 1" class="liBox2" style="width: 100%">
                    <div>
                      <span>大于</span>
                      <el-input-number v-model="v3.singleMinDistance" size="mini" disabled :controls="false"></el-input-number>
                    </div>
                    <div>
                      <span>千米</span>
                      <b>：</b>
                      <span>每增加</span>
                      <el-input-number v-model="v3.addDistance" size="mini" :controls="false" :min="0" style="width: 80px" :disabled="modifyType"></el-input-number>
                      <span>千米，增加</span>
                      <el-input-number v-model="v3.singleDistancePrice" size="mini" :controls="false" :min="0" style="width: 80px" :disabled="modifyType"></el-input-number>
                      <span>元/方</span>
                    </div>
                    <div>
                      <span>运输系数</span>
                      <el-input-number v-model="v3.coefficient" size="mini" :disabled="modifyType" :controls="false"></el-input-number>
                    </div>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>
            <div>
              <div style="padding-bottom: 10px;">
                <el-button size="mini" class="bottom_all" style="margin-left: 0;" :disabled="modifyType" @click="carThreesArrAdd()">
                  <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
                  添加
                </el-button>
              </div>
              <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="carThreesArr" tooltip-effect="dark">
                <el-table-column label="浇筑方式" align="center">
                  <template slot-scope="scope">
                    <el-select v-model="scope.row.pouringMethodId" placeholder="请选择" style="width: 100%;" :disabled="modifyType" @change="pouringMethodNameChangeItem(scope.row,scope.$index)">
                      <el-option v-for="(item, index) in pouringMethodIdList" :key="index" :label="item.itemName" :value="item.id"></el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column label="增加单价（元/方）" align="center">
                  <template slot-scope="scope">
                    <el-input-number v-model="scope.row.unitPrice" :precision="0" style="width: 100%;" :disabled="modifyType" :controls="false"></el-input-number>
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="left" prop="specification">
                  <template slot-scope="scope">
                    <el-button size="mini" class="bottom_two" :disabled="modifyType" @click="carThreesArrDel(scope.$index)">
                      <i class="icon iconfont iconicon_button_delete" style="font-size: 12px;"></i>
                      删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div v-if="formDate.cargoTypeId == 3" class="FZY1-text">
            <el-form-item>
              <span slot="label">备注</span>
              <el-input v-model="formDate.cargoRemark" style="width: 580px" type="textarea" placeholder="请输入备注信息" clearable :rows="5" resize="none" :disabled="modifyType"></el-input>
            </el-form-item>
          </div>
          <div v-if="formDate.cargoTypeId != 3">
            <div v-if="formDate.cargoTypeId == 2">
              <el-form-item prop="assessmentPrice" :rules="[{required: true,message: '请输入参考价格',trigger: 'blur',}]" style="margin-top: 10px;width:270px;">
                <span slot="label">考核价</span>
                <el-input v-model="formDate.assessmentPrice" style="width:100px;" placeholder="请输入" clearable :disabled="modifyType" onblur="if(value > 10000 ){ value = 10000}else if(value < 1 ){ value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.assessmentPrice=$regExp.checkNum(formDate.assessmentPrice)" @blur="formDate.assessmentPrice=$regExp.blurCheckNum(formDate.assessmentPrice)"></el-input>
                <span style="margin-left: 10px">元</span>
              </el-form-item>
              <el-form-item prop="smallTransRules" :rules="[{required: true,message: '请输入小方量规则',trigger: 'blur',}]" style="margin-top: 10px">
                <span slot="label">小方量规则</span>
                <span>运输不足 </span>
                <el-input v-model="formDate.smallTransRules" style="width:100px;" placeholder="请输入" clearable :disabled="modifyType" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.smallTransRules=$regExp.checkNum(formDate.smallTransRules)" @blur="formDate.smallTransRules=$regExp.blurCheckNum(formDate.smallTransRules)"></el-input>
                <span> 方，按 </span>
                <el-input v-model="formDate.smallTransPrice" style="width:100px;" placeholder="请输入" clearable :disabled="modifyType" onblur="if(value > 10000 ){ value = 10000}else if(value < 1 ){ value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.smallTransPrice=$regExp.checkNum(formDate.smallTransPrice)" @blur="formDate.smallTransPrice=$regExp.blurCheckNum(formDate.smallTransPrice)"></el-input>
                <span style="margin-left: 10px">元/方计算</span>
              </el-form-item>
              <el-form-item prop="oncePouringRules" :rules="[{required: true,message: '请输入单次浇筑规则',trigger: 'blur',}]" style="margin-top: 10px">
                <span slot="label">单次浇筑规则</span>
                <span>单次浇筑不足 </span>
                <el-input v-model="formDate.oncePouringRules" style="width:100px;" placeholder="请输入" clearable :disabled="modifyType" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.oncePouringRules=$regExp.checkNum(formDate.oncePouringRules)" @blur="formDate.oncePouringRules=$regExp.blurCheckNum(formDate.oncePouringRules)"></el-input>
                <span> 方，按 </span>
                <el-input v-model="formDate.oncePouringPrice" style="width:100px;" placeholder="请输入" clearable :disabled="modifyType" onblur="if(value > 10000 ){ value = 10000}else if(value < 1 ){ value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.oncePouringPrice=$regExp.checkNum(formDate.oncePouringPrice)" @blur="formDate.oncePouringPrice=$regExp.blurCheckNum(formDate.oncePouringPrice)"></el-input>
                <span style="margin-left: 10px">方/元计算</span>
              </el-form-item>
            </div>
            <el-form-item prop="oilPrice" style="margin-top: 10px">
              <span slot="label">柴油基准价</span>
              <el-input v-model="formDate.oilPrice" placeholder="请输入" clearable :disabled="modifyType" onblur="if(value > 10000 ){ value = 10000}else if(value < 1 ){ value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.oilPrice=$regExp.checkNum(formDate.oilPrice)" @blur="formDate.oilPrice=$regExp.blurCheckNum(formDate.oilPrice)"> <template slot="append">元/升</template></el-input>
            </el-form-item>
            <el-form-item style="margin-top:10px;">
              <span slot="label">集中供气费用</span>
              <el-input v-model="formDate.airFeedCost" placeholder="请输入" :disabled="modifyType" onblur="if(value > 10000 ){ value = 10000}else if(value < 1 ){ value = 1}" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="formDate.airFeedCost=$regExp.checkNum(formDate.airFeedCost)" @blur="formDate.airFeedCost=$regExp.blurCheckNum(formDate.airFeedCost)">
                <template slot="append">元/吨</template>
              </el-input>
            </el-form-item>
          </div>
          <div class="form-title">结算规则</div>
          <el-form-item prop="clearingFormId">
            <span slot="label">结算方式</span>
            <el-select v-model="formDate.clearingFormId" placeholder="请选择" :disabled="modifyType">
              <el-option v-for="(item, index) in clearingFromIdList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="paymentMethod" :rules="[{required: true,message: '请选择付款方式',trigger: 'change',}]">
            <span slot="label">付款方式</span>
            <el-select v-model="formDate.paymentMethod" placeholder="请选择" :disabled="modifyType">
              <el-option label="账龄" :value="1"></el-option>
              <el-option label="比例" :value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="formDate.paymentMethod==1" prop="aging" :rules="[{required: formDate.paymentMethod==1,message: '请选择账龄',trigger: 'change',}]">
            <span slot="label">账龄</span>
            <el-select v-model="formDate.aging" placeholder="请选择" :disabled="modifyType">
              <el-option label="1月" :value="1"></el-option>
              <el-option label="2月" :value="2"></el-option>
              <el-option label="3月" :value="3"></el-option>
              <el-option label="4月" :value="4"></el-option>
              <el-option label="5月" :value="5"></el-option>
              <el-option label="6月" :value="6"></el-option>
              <el-option label="7月" :value="7"></el-option>
              <el-option label="8月" :value="8"></el-option>
              <el-option label="9月" :value="9"></el-option>
              <el-option label="10月" :value="10"></el-option>
              <el-option label="11月" :value="11"></el-option>
              <el-option label="12月" :value="12"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="formDate.paymentMethod==2" prop="paymentRatio" :rules="[{required: formDate.paymentMethod==2,message: '请输入支付比例',trigger: 'change',}]">
            <span slot="label">支付比例(%)</span>
            <el-input-number v-model="formDate.paymentRatio" :precision="2" style="width: 130px;" :max="100" :disabled="modifyType" :controls="false"></el-input-number>
          </el-form-item>
          <el-form-item>
            <span slot="label">结算说明</span>
            <el-input v-model="formDate.explains" style="width: 800px" type="textarea" placeholder="请输入" clearable :rows="2" resize="none" :disabled="modifyType" maxlength="200" show-word-limit></el-input>
          </el-form-item>
          <div class="form-title">
            增值服务
          </div>
          <el-form-item prop="processModel">
            <span slot="label">流程模式</span>
            <el-select v-model="formDate.processModel" placeholder="请选择" :disabled="modifyType" @change="processModelFun()">
              <el-option label="传统工艺流程模式" value="1"></el-option>
              <el-option label="电子工艺流程模式" value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <span slot="label"></span>
            <el-button size="mini" class="bottom_all" style="margin-left: 0" @click="stationsControlPointFun()">管控业务点</el-button>
          </el-form-item>
          <div class="form-title">附件</div>
          <FileComponent fileCode="carFile" :disabled="modifyType" :files="files" @deleteFile="deleteFile" @uplodeSuccess="uplodeSuccess" />
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="addDialog = false">关 闭</el-button>
        <el-button v-show="!modifyType" class="bottom_all" style="margin-left: 24px;" :disabled="modifyType" @click="pagessubmitFromDate()">保 存</el-button>
      </span>
    </el-dialog>
    <!-- 业务管控点 -->
    <el-dialog v-dialogDrag :visible.sync="controlPoint_Dialog" width="800px">
      <span slot="title" class="dialog-title">管控业务点设置</span>
      <div class="dialoginfo">
        <div class="FZYguanKongYeWuDian">
          <table>
            管控业务点：
          </table>
          <div class="FZYcheckbox">
            <div v-if="formDate.processModel==1">
              <el-checkbox v-for="(v,k) in businessCheckbox" :key="k" :label="v.id" :disabled="true" checked>{{v.itemName}}</el-checkbox>
            </div>
            <el-checkbox-group v-else v-model="formDate.business">
              <el-checkbox v-for="(v,k) in businessCheckbox" :key="k" :label="v.id" :disabled="modifyType">{{v.itemName}}</el-checkbox>
            </el-checkbox-group>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all" style="margin-left: 24px" @click="controlPoint_Dialog = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 站点运输价及到岸价查看 -->
    <el-dialog v-dialogDrag :visible.sync="thePrice_Dialog" width="550px">
      <span slot="title" class="dialog-title">站点运输价及到岸价</span>
      <div class="dialoginfo"></div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="thePrice_Dialog = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 协作单位 -->
    <el-dialog v-dialogDrag :visible.sync="cooperativeUnit_Dialog" width="550px">
      <span slot="title" class="dialog-title">协作单位</span>
      <div class="dialoginfo">
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="cooperativeUnitArr" tooltip-effect="dark">
          <el-table-column label="协作单位" align="center" prop="name"></el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="cooperativeUnit_Dialog = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 合同产品列表 -->
    <el-dialog v-dialogDrag :visible.sync="riseInPriceQueryOneByidType" width="1000px">
      <span slot="title" class="dialog-title">合同产品列表</span>
      <div class="dialoginfo">
        <el-table v-if="formDate.cargoTypeId == 1" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="cplistArr" tooltip-effect="dark" class="FZYselectList">
          <el-table-column label="原物料合同" align="center" width="180" prop="contractNo"></el-table-column>
          <el-table-column label="起运地" align="center" width="180" prop="startAddress" show-overflow-tooltip></el-table-column>
          <el-table-column label="到岸地价格（元/吨）" align="center">
            <el-table-column v-for="(v, k) in formDate.carVo.list" :key="k" align="center" min-width="180">
              <template slot="header" slot-scope="scope">
                <el-select :ref="scope.row" v-model="v.stationId" size="mini" placeholder="选择站点" disabled style="width: 100% !important">
                  <el-option v-for="(item, index4) in sitelist" :key="index4" :label="item.label" :value="item.value"></el-option>
                </el-select>
              </template>
              <template slot-scope="scope">
                <el-button v-for="(v2, k2) in scope.row.list" v-show="k2 == k" :key="k2" class="bottom_text" @click="QueryOneByidFun(v2.id)">查看</el-button>
              </template>
            </el-table-column>
          </el-table-column>
        </el-table>
        <div v-if="formDate.cargoTypeId == 2" class="FZY1-3">
          <el-table v-if="formDate.cargoTypeId == 2" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="[{}]" tooltip-effect="dark" class="FZYselectList">
            <template v-for="(item, index2) in tabsArr">
              <el-table-column :key="index2" :label="item.stationName" align="center">
                <template slot-scope="scope">
                  <el-link :ref="scope" class="table_link" :underline="false" @click="QueryOneByidFun(item.stationId,true)">价格设置</el-link>
                </template>
              </el-table-column>
            </template>
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="riseInPriceQueryOneByidType = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 价格设置-调价详情 -->
    <el-dialog v-dialogDrag :visible.sync="QueryOneByidType" width="800px">
      <span slot="title" class="dialog-title">价格设置</span>
      <div class="dialoginfo">
        <div v-show="$options.filters.moneyFun(moneyType)" class="FZY1-3" style="border-bottom:0px;margin-bottom:10px;">
          <div v-for="(v3,k3) in carTwosArr" :key="k3">
            <div v-if="k3 == 0" class="liBox1">
              <div>
                <span>小于</span>
                <el-input-number v-model="v3.maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
              </div>
              <div>
                <span>米</span>
                <b>：</b>
                <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" :disabled="modifyType"></el-input-number>
                <span>元/方</span>
              </div>
            </div>
            <div v-if="k3 > 0  && k3 != carTwosArr.length-1" class="liBox3">
              <div>
                <div>
                  <el-input-number v-model="v3.minDistance" size="mini" :controls="false" :precision="2" :disabled="modifyType" @change="carTwosArr[k3-1].maxDistance = v3.minDistance" @blur="inpuSizeCheck2(v3.minDistance,k3,carTwosArr)"></el-input-number>
                  <span>至</span>
                  <el-input-number v-model="v3.maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
                </div>
                <div>
                  <span>米</span>
                  <b>：</b>
                  <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" :disabled="modifyType"></el-input-number>
                  <span>元/方</span>
                </div>
              </div>
              <div>
                <el-button v-if="carTwosArr.length-2 == k3" class="bottom_text" :disabled="modifyType" @click="addJson()">添加区间</el-button>
                <el-button v-else class="bottom_text" :disabled="modifyType" @click="delJson(k3)">删除区间</el-button>
              </div>
            </div>
            <div v-if="k3 == carTwosArr.length-1" class="liBox2" style="width:100%;">
              <div>
                <span>大于</span>
                <el-input-number v-model="v3.minDistance" size="mini" :controls="false" :precision="2" :disabled="modifyType" @change="carTwosArr[k3-1].maxDistance = v3.minDistance" @blur="inpuSizeCheck2(v3.minDistance,k3,carTwosArr)"></el-input-number>
              </div>
              <div>
                <span>米</span>
                <b>：</b>
                <span>每增加</span>
                <el-input-number v-model="v3.addDistance" size="mini" :controls="false" :min="0" style="width:80px;" :disabled="modifyType"></el-input-number>
                <span>米，增加</span>
                <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" style="width:80px;" :disabled="modifyType"></el-input-number>
                <span>元/方</span>
              </div>
            </div>
          </div>
        </div>
        <el-form ref="contractRawMoneySaveForm" label-width="80px" :model="contractRawMoneySaveForm" :rules="contractRawMoneySaveFormRules" class="FZYform2">
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item v-if="!$options.filters.moneyFun(moneyType)" label="价格" prop="money">
                <el-input v-model="contractRawMoneySaveForm.money" type="Number" placeholder :controls="false">
                  <template slot="append">元/吨</template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="生效日期" prop="startTime">
                <el-date-picker v-model="contractRawMoneySaveForm.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <div style="margin-left: 24px;"><FileComponent2 fileCode="contractFile" :files="files2" @deleteFile="deleteFile2" @uplodeSuccess="uplodeSuccess2" /></div>
            </el-col>
            <el-col :span="2" style="margin-bottom: 20px;">
              <el-button class="bottom_all" @click="contractRawMoneySaveFun()">添加</el-button>
            </el-col>
          </el-row>
        </el-form>
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="QueryOneByidArr" tooltip-effect="dark">
          <el-table-column label="价格" prop="money" align="center">
            <template slot-scope="scope">
              <el-link v-if="$options.filters.moneyFun(moneyType)" class="table_link" :underline="false" @click="basePriceListFun2(scope.row)">查看</el-link>
              <span v-else>{{scope.row.money}} 元/吨</span>
            </template>
          </el-table-column>
          <el-table-column label="生效日期" prop="startTime" align="center"></el-table-column>
          <el-table-column label="附件" align="center" width="120">
            <template slot-scope="scope">
              <el-button size="mini" class="bottom_all_two" @click="lookFile(scope)">查看</el-button>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="120">
            <template slot-scope="scope">
              <el-link class="table_link" :underline="false" @click="contractRawMoneyDeletesFun(scope.row)">删除</el-link>
            </template>
          </el-table-column>
        </el-table>
        <div class="card_bottom">
          <div class="card_bottom_left">
            <div class="top_page_totle">
              总共{{ QueryOneByidObject.total }}条
            </div>
            <el-pagination :current-page.sync="QueryOneByidObject.page" :page-size="QueryOneByidObject.pageSize" layout="prev, pager, next, jumper" :total="QueryOneByidObject.total" @current-change="QueryOneByidFun()"></el-pagination>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="QueryOneByidType = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 开户信息 -->
    <el-dialog v-dialogDrag :visible.sync="AllqueryListsByPid" width="550px">
      <span slot="title" class="dialog-title">开户信息维护</span>
      <div class="dialoginfo">
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="queryListsByPidArr" tooltip-effect="dark">
          <el-table-column label="单位名称" prop="name" align="center"></el-table-column>
          <el-table-column label="开户信息">
            <template slot-scope="scope">
              <el-link class="table_link" :underline="false" @click="
                  contractAccountGetDetailFun(scope.row.id, scope.$index + 1)
                ">开户信息</el-link>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="AllqueryListsByPid = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 开户信息详情-编辑 -->
    <el-dialog v-dialogDrag :visible.sync="contractAccountGetDetailType" width="800px">
      <span slot="title" class="dialog-title">开户信息</span>
      <div class="dialoginfo">
        <el-form ref="contractAccountSaveForm" label-width="130px" :model="contractAccountSaveForm" :rules="contractAccountSaveRules" class="FZYform2">
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="法定代表人" prop="name" :rules="[{required: true,message: '请输入法定人',trigger: 'blur',}]">
                <el-input v-model="contractAccountSaveForm.name"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="法人身份证号码" prop="identityCard">
                <el-input v-model="contractAccountSaveForm.identityCard"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="合同条款" prop="contractPact" :rules="[{required: true,message: '请输入合同条款',trigger: 'blur',}]">
                <el-input v-model="contractAccountSaveForm.contractPact"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode" :rules="[{required: true,message: '请输入信用代码',trigger: 'blur',}]">
                <el-input v-model="contractAccountSaveForm.unifiedSocialCreditCode"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="收款方式">
                <div style="width: 100px;">现金</div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="单位开户银行">
                <el-input v-model="contractAccountSaveForm.bankDepositA"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="单位开户账号">
                <el-input v-model="contractAccountSaveForm.accountA"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开户银行联行号">
                <el-input v-model="contractAccountSaveForm.bankNumberA"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="收款方式">
                <div style="width: 100px;">电子承兑</div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="单位开户银行">
                <el-input v-model="contractAccountSaveForm.bankDepositB"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="单位开户账号">
                <el-input v-model="contractAccountSaveForm.accountB"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开户银行联行号">
                <el-input v-model="contractAccountSaveForm.bankNumberB"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="收款方式">
                <div style="width: 100px;">商票</div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="单位开户银行">
                <el-input v-model="contractAccountSaveForm.bankDepositC"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="单位开户账号">
                <el-input v-model="contractAccountSaveForm.accountC"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开户银行联行号">
                <el-input v-model="contractAccountSaveForm.bankNumberC"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="收款方式">
                <div style="width: 100px;">其他</div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="单位开户银行">
                <el-input v-model="contractAccountSaveForm.bankDepositD"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="单位开户账号">
                <el-input v-model="contractAccountSaveForm.accountD"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开户银行联行号">
                <el-input v-model="contractAccountSaveForm.bankNumberD"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="contractAccountGetDetailType = false">关 闭</el-button>
        <el-button class="bottom_all" style="margin-left: 24px;" @click="contractAccountSaveFun()">保 存</el-button>
      </span>
    </el-dialog>
    <!-- 价格区间弹窗 -->
    <el-dialog v-dialogDrag :visible.sync="basePriceListType2" width="800px">
      <span slot="title" class="dialog-title">泵送高度及价格</span>
      <div class="dialoginfo FZY1-3">
        <div v-for="(v3,k3) in carTwosArr2" :key="k3">
          <div v-if="k3 == 0" class="liBox1">
            <div>
              <span>小于</span>
              <el-input-number v-model="v3.maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
            </div>
            <div>
              <span>米</span>
              <b>：</b>
              <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" disabled></el-input-number>
              <span>元/方</span>
            </div>
          </div>
          <div v-if="k3 > 0  && k3 != carTwosArr2.length-1" class="liBox3">
            <div>
              <div>
                <el-input-number v-model="carTwosArr2[k3-1].maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
                <span>至</span>
                <el-input-number v-model="v3.maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
              </div>
              <div>
                <span>米</span>
                <b>：</b>
                <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" disabled></el-input-number>
                <span>元/方</span>
              </div>
            </div>
          </div>
          <div v-if="k3 == carTwosArr2.length-1" class="liBox2" style="width:100%;">
            <div>
              <span>大于</span>
              <el-input-number v-model="carTwosArr2[k3-1].maxDistance" size="mini" :controls="false" :precision="2" disabled></el-input-number>
            </div>
            <div>
              <span>米</span>
              <b>：</b>
              <span>每增加</span>
              <el-input-number v-model="v3.addDistance" size="mini" :controls="false" :min="0" style="width:80px;" disabled></el-input-number>
              <span>米，增加</span>
              <el-input-number v-model="v3.price" size="mini" :controls="false" :min="0" style="width:80px;" disabled></el-input-number>
              <span>元/方</span>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="basePriceListType2 = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 列表单选 -->
    <el-dialog v-dialogDrag :visible.sync="ListChoiceType" width="90%" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">选择</span>
      <div class="dialogOtherinfo fzyDivFlex">
        <div>
          <p></p>
          <div style="margin-bottom:10px;">
            原物料合同
            <el-input v-model="contractNumber" style="width:150px;margin-right:10px;" placeholder="合同编号"></el-input>
            <el-input v-model="supplierName" style="width:150px;margin-right:10px;" placeholder="主合同单位"></el-input>
            <el-button class="bottom_all_two" @click="serachContract">查询</el-button>
          </div>
          <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" height="500" :data="ListChoiceData" tooltip-effect="dark" highlight-current-row @row-click="ListChoiceFun">
            <el-table-column width="50" fixed>
              <template slot-scope="scope">
                <el-radio v-model="ListChoiceRadio" :label="scope.row.id">{{""}}</el-radio>
              </template>
            </el-table-column>
            <el-table-column prop="contractNumber" label="合同编号" width="auto" align="center"></el-table-column>
            <el-table-column prop="contractType" label="合同类型" width="auto" align="center"></el-table-column>
            <el-table-column prop="firstParty" label="甲方公司" width="auto" align="center"></el-table-column>
            <el-table-column prop="stations" label="站点名称" width="auto" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.stations|stationsFun }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="supplierName" label="主合同单位" width="90" align="center"></el-table-column>
            <el-table-column prop="callForBidsNumber" label="招标编号" width="auto" align="center"></el-table-column>
          </el-table>
          <div class="card_bottom">
            <div class="card_bottom_left">
              <div class="top_page_totle">
                总共{{ serachParams.total }}条
              </div>
              <el-pagination :current-page.sync="serachParams.page" :page-size="serachParams.pageSize" layout="prev, pager, next, jumper" :total="serachParams.total" @current-change="serachContract()"></el-pagination>
            </div>
          </div>
        </div>
        <div>
          <div style="margin-bottom:10px;">
            合同供应产品
          </div>
          <el-table ref="ListChoiceData2" :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" height="500" :data="ListChoiceData2" tooltip-effect="dark" highlight-current-row @selection-change="productSelection">
            <el-table-column type="selection" width="50" fixed>
            </el-table-column>
            <el-table-column prop="productName" min-width="110" label="原物料名称" width="auto" align="center"></el-table-column>
            <el-table-column prop="brand" label="品牌" min-width="80" width="auto" align="center"></el-table-column>
            <el-table-column prop="specification" min-width="80" label="规格" width="auto" align="center"></el-table-column>
            <el-table-column prop="supplierName" width="70" label="是否甲供" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.isFirstSupply == 1">是</span>
                <span v-else>否</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="ListChoiceType = false">取 消</el-button>
        <el-button :disabled="modifyType||productSelectionList.length==0" class="bottom_all" style="margin-left: 24px;" @click="ListChoiceAddFun()">确 定</el-button>
      </span>
    </el-dialog>
    <ModifyTheRecord ref="ModifyTheRecord"></ModifyTheRecord>
    <diaLog1 :dialog="dialog1" :low="low" :supplierId="supplierId" @reset="reset1" @submit="submit"></diaLog1>

    <LookFile :visible.sync="lookFileVisible" :config="lookFileConfig" />
  </div>
</template>

<script>
import FileComponent2 from '@/views/platform/ICPS/internetSales/components/fileComponent';
import LookFile from "@/components/File/LookFile"
import mixin from "@/mixins/ICPSmixin.js";
import FileComponent from '@/components/File/fileComponent';
import {
  queryPage,
  batchUpdateOrDelete,
  updateSortNum,
  saveOrUpdate,
  Download,
  engineeringManagementQueryPage,
  processes_collection,
  contractSaveOrUpdate,
  contractQueryDetailById,
  QueryOneByid,
  contractRawMoneySave,
  contractRawMoneyDeletes,
  contractAccountGetDetail,
  contractAccountSave,
  PumpPriceLogSave,
  PumpPriceLogDeletes,
  PumpPriceLogGetDetail,
  getRawContractsByRawId,
  queryContractNumber,
  contractProductgetListByPid,
  queryStationsByID,
  QueryPageBystationId,
} from "@/api/GHnumber/car.js";
import { querysupplierPage, queryListsByPid } from "@/api/GHnumber/supplier.js";
import { getDicType, getDicsType } from "@/api/common.js";
import { getUserInfo } from "@/utils/auth.js";
import { getUserAutList } from "@/api/common.js";
import ModifyTheRecord from './modifyTheRecord';
import { getOrganizationBytypes } from '@/api/internetSales/chanceManagement'
const diaLog1 = () => import("../dialog/contract1")
export default {
  components: { FileComponent, ModifyTheRecord, diaLog1, FileComponent2, LookFile },
  mixins: [mixin],
  watch: {
    "formDate.startDayendDay"() {
      this.formDate.startDay = this.formDate.startDayendDay[0];
      this.formDate.endDay = this.formDate.startDayendDay[1];
    },
    yiFenPeiRadio: {
      handler: function (val) {
        this.ids = [val.id]
      },
      deep: false,
    },
  },
  data() {
    var userCard = (rule, value, callback) => {
      //验证身份证号码
      var reg = new RegExp(
        /^(([1][1-5])|([2][1-3])|([3][1-7])|([4][1-6])|([5][0-4])|([6][1-5])|([7][1])|([8][1-2]))\d{4}(([1][9]\d{2})|([2]\d{3}))(([0][1-9])|([1][0-2]))(([0][1-9])|([1-2][0-9])|([3][0-1]))\d{3}[0-9xX]$/
      );
      if (!reg.test(value)) {
        callback(new Error("请输入正确的身份证号码"));
      } else {
        callback();
      }
    };
    return {
      roadWorkList: [], // 合同签订主体数据
      lookFileVisible: false,
      lookFileConfig: {},
      files2: [],
      serachParams: {
        page: 1,
        pageSize: 10,
        total: 0,
      },
      low: '',
      dialog1: false,
      UserInfo: "",
      stationIdlist: [],
      carThreesArr: [],
      pouringMethodIdList: [],
      basePriceListType2: false,
      carTwosArr2: [],
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      batchUpdateOrDelete: batchUpdateOrDelete, //启用禁用接口
      updateSortNum: updateSortNum,
      saveOrUpdate: saveOrUpdate,
      DownloadURL: Download,
      /*表格数据*/
      table: [
        { label: "合同ID", width: "120", prop: "code", status: true },
        { label: "合同类型", width: "120", prop: "contractType", status: true },
        {
          label: "甲方公司",
          width: "auto",
          prop: "firstParty",
          status: true,
        },
        { label: "站点名称", width: "120", prop: "stations", status: true },
        {
          label: "主合同单位",
          width: "auto",
          prop: "supplierName",
          status: true,
        },
        {
          label: "供应商类别",
          width: "120",
          prop: "supplierType",
          status: true,
        },
        {
          label: "合同编号",
          width: "auto",
          prop: "contractNumber",
          status: true,
        },
        {
          label: "合同签订情况",
          width: "auto",
          prop: "concludeAndSignStatus",
          status: true,
        },
        {
          label: "华西云采注册情况",
          width: "120",
          prop: "loginStatus",
          status: true,
        },
        { label: "合同有效期", width: "145", prop: "startDay", status: true },
        {
          label: "招标编号",
          width: "120",
          prop: "callForBidsNumber",
          status: true,
        },
        {
          label: "合作等级",
          width: "auto",
          prop: "cooperationClass",
          status: true,
        },
        { label: "状态", width: "120", prop: "", status: true },
        { label: "操作", width: "100", prop: "", status: true },
      ],
      modifyType: false, //修改是否可以状态
      text:
        "含水率规则：0≤x≤5%，按照5%结算；5%＜X≤8%，按照8%结算；8%<x≤13%，按照实测结算；13%<x，按照实测结算，并5元/吨处罚",
      clearingFromIdList: [
        // { id: '0', name: '双控' },
        // { id: '1', name: '图算' },
        { id: '2', name: '实结' },
      ], //结算方式
      companylist: [], //甲方公司
      sitelist: [], //站点名称
      supplierList: [], //主合同单位名称
      MaterialsList: [], //原物料
      AForContract: [], //是否甲供合同
      theUnitPriceSource: [
        {
          id: "1",
          itemName: "已信息价结算",
        },
        {
          id: "2",
          itemName: "已内部价结算",
        },
        {
          id: "3",
          itemName: "已市场价结算",
        },
        {
          id: "4",
          itemName: "已出厂价结算",
        },
        {
          id: "5",
          itemName: "已到岸价结算",
        },
      ], //单价来源
      engineeringManagement: [], //甲供工程
      thePrice_Dialog: false, //价格表弹窗
      controlPoint_Dialog: false, //业务管控点弹窗
      cooperativeUnit_Dialog: false, //协作单位弹窗
      rules: {
        firstPartyId: [
          { required: true, message: "请选择甲方公司", trigger: "change" },
        ],
        contractSigningSubjectId: [
          { required: true, message: "请选择合同签订主体", trigger: "change" },
        ],
        stationsList: [
          { required: true, message: "请选择站点名称", trigger: "change" },
        ],
        supplierId: [
          { required: true, message: "请选择主合同单位", trigger: "change" },
        ],
        contractNumber: [
          { required: true, message: "请输入合同编号", trigger: "change" },
        ],
        callForBidsNumber: [
          { required: true, message: "请输入招标编号", trigger: "change" },
        ],
        concludeAndSignStatus: [
          { required: true, message: "请选择合同签订情况", trigger: "change" },
        ],
        loginStatus: [
          {
            required: true,
            message: "请选择华西云采注册情况",
            trigger: "change",
          },
        ],
        linkman: [{ required: true, message: "请输入联系人", trigger: "change" }],
        phone: [
          { required: true, message: "请输入联系电话", trigger: "change" },
          { min: 11, max: 11, message: "手机号格式错误", trigger: "change" },
        ],
        startDayendDay: [
          { required: true, message: "请选择合同有效期", trigger: "change" },
        ],
        userType: [
          { required: true, message: "请选择用户账号", trigger: "change" },
        ],
        companyId: [
          { required: true, message: "请选择公司", trigger: "change" },
        ],
        stationId: [
          { required: true, message: "请选择站点", trigger: "change" },
        ],
        clearingFormId: [
          { required: true, message: "请选择结算方式", trigger: "change" },
        ],
        oilPrice: [
          { required: true, message: "请输入柴油基准价", trigger: "change" },
        ],
        processModel: [
          { required: true, message: "请选择流程模式", trigger: "change" },
        ],
      },
      formDate: {
        stationsList: [],
        userType: [],
        startDayendDay: [],
        id: "",
        contractTypeId: "2",
        contractType: "车辆外包",
        firstParty: "", //甲方
        supplierName: "", //供应商
        supplierTypeId: "", //供应商类型id
        userId: "",
        userName: "",
        firstSupplyName: "", //甲供合同
        clearingSource: "", //结算原
        clearingForm: "", //结算方式
        accessory: [], //附件
        cooperationClass: "合作等级", //甲方公司里面出来的
        cooperationClassId: "合作等级id", //甲方公司里面出来的
        business: [], //业务点1，2，3
        cargoTypeId: 1, //货物类型
        carTwos: [],
        carThrees: [],
        carVo: {
          //自定义表头
          list: [
            {
              station: "",
              stationId: "",
              type: 1, //1新增 2修改 0删除
            },
          ],
          //表格内容
          mlist: [],
        },
        oilPrice: '',
      },
      businessCheckbox: [], //业务点
      cooperativeUnitArr: [], //外协单位列表
      riseInPriceQueryOneByidType: false,
      riseInPriceQueryOneByidArr: [], //调价列表
      contractId: "", //原物料列表
      QueryOneByidType: false,
      QueryOneByidArr: [], //调价列表
      contractIdArr: [], //非运输货物原物料list
      cargoTypeIdArr: [
        {
          id: 1,
          name: "原物料",
        },
        {
          id: 2,
          name: "混凝土产品",
        },
        {
          id: 3,
          name: "其他",
        },
      ],
      QueryOneByidObject: {
        //调价分页
        page: 1,
        pageSize: 10,
        total: 0,
      },
      contractRawMoneySaveForm: { startTime: "" },
      contractRawMoneySaveFormRules: {
        money: [{ required: true, message: "请输入价格", trigger: "blur" }],
        startTime: [
          { required: true, message: "请选择生效日期", trigger: "blur" },
        ],
      },
      AllqueryListsByPid: false,
      queryListsByPidArr: [], //开户信息-协作单位合并列表
      contractAccountGetDetailType: false,
      //开户信息表单
      contractAccountSaveForm: {
        contractPactId: "", //合同条约id
        contractPact: "", //合同条约
      },
      contractAccountSaveRules: {
        identityCard: [
          { required: true, validator: userCard, trigger: "change" },
        ], //身份证
      },
      cplistArr: [], //供应产品列表显示部分
      carTwosArr: [], //混凝土价格区间信息
      moneyType: false,//是否是区间调价
      ListChoiceType: false,//单选表格是否打开
      ListChoiceData: [],//单选表格数据
      ListChoiceData2: [],//原物料复选表格数据
      ListChoiceRadio: '',//单选表格选中项
      ListChoiceRadioCopy: '',//当前打开的单选表格选中项
      ListChoiceRadioRow: {},//单选表格选中的对象
      ListChoiceDataIndex: '',//点击的表格数据下标
      appPackage: [],
      files: [],
      productSelectionList: [],//原物料复选
      tabsArr: [],//选的站点卡片数组
      editableTabsValue: '0',
      yiFenPeiRadio: '',
      supplierId: '',
      supplierName: '',
      contractNumber: '',
    };
  },
  async created() {
    this.UserInfo = getUserInfo();
    this.companylist = await getUserAutList()
    const arr = this.companylist.map(item=>item.children)
    arr.forEach(item=>{
      item.forEach(sItem=>{
        this.sitelist.push(sItem)
      })
    })
    let params = {
      page: 1,
      pageSize: 10000,
    };
    engineeringManagementQueryPage({
      isAssess: 1,
      page: 1,
      pageSize: 10000,
    }).then((res) => {
      this.engineeringManagement = res.data.data;
    });
    querysupplierPage(params).then((res) => {
      this.supplierList = res.data.data;
    });
    getDicType({ code: "MATname" }).then((res) => {
      this.MaterialsList = res.data.items; //
    });
    getDicType({ code: "contractType" }).then((res) => {
      this.contractTypeArry = res.data.items; //
    });
    getDicType({
      code: "castingType",
    }).then((res) => {
      res.data.items.map((v1) => v1.type = 1);
      this.pouringMethodIdList = res.data.items
      getDicType({
        code: "pouringMethod",
      }).then((res) => {
        res.data.items.map((v2) => v2.type = 2)
        this.pouringMethodIdList = [...this.pouringMethodIdList, ...res.data.items];
      });
    });
    getDicType({ code: "HuaXiYunCai_Registration" }).then((res) => {
      this.HuaXiYunCai_RegistrationArry = res.data.items; //
    });
    getDicType({ code: "AForContract" }).then((res) => {
      this.AForContract = res.data.items; //
    });
    getOrganizationBytypes({typeId:'19da56b9e85648059e3cf1e7da497da4,110572600018735104'}).then(res => {
      if (res.code === 1001) {
        this.roadWorkList = res.data;
      }
    })
  },
  methods: {
    lookFile({row}) {
      this.lookFileVisible = true;
      this.lookFileConfig = row
    }, 
    uplodeSuccess2(data) {
      const params = {
        name: data.fileName,
        fileName: data.fileName,
        fileUrl: data.fileUrl,
        path: data.fileUrl,
        fileType: 1,
        type: 1,
        createTime: new Date().Format('yyyy-MM-dd hh:mm:ss'),
      }
      this.files2.push(params);
    },
    deleteFile2(index) {
      this.files2.splice(index, 1);
    },
    /**分配账号*/
    open(low, key) {
      this.supplierId = low.supplierId
      this.low = low.id;
      this[key] = true;
    },
    reset1(key) {
      this[key] = false;
    },
    submit(key) {
      this[key] = false;
    },
    /**混凝土时-组装站点区间价格头部,站点选择后清空管控业务点 */
    stationsListFun() {
      this.formDate.business = []
      let arr = [];
      this.formDate.stationsList.forEach((v) => {
        this.sitelist.forEach((v2) => {
          if (v == v2.value) {
            arr.push({
              id: v,
              name: v2.label,
            });
          }
        });
      });
      this.tabsArr.forEach((v, k) => {
        if (this.formDate.stationsList.findIndex((res) => res == v.stationId) == -1) {
          this.tabsArr.splice(k, 1)
        }
      })
      this.formDate.stationsList.forEach((v) => {
        if (this.tabsArr.findIndex((res) => res.stationId == v) == -1) {
          let item = this.sitelist.find((v2) => v2.value == v)
          let list = this.copy(this.resetCarTwos())
          this.tabsArr.push({
            stationId: v,
            stationName: item.label,
            list: list
          })
        }
      })
      this.editableTabsValue = '0'
    },
    /**
     * @Description: 删除附件
     * @Param: 
     * @Author: wangwangwang
     */
    deleteFile(index) {
      this.files.splice(index, 1);
    },
    /**
     * @Description: 上传成功
     * @Param: 
     * @Author: wangwangwang
     */
    uplodeSuccess(data) {
      this.files.push(data);
    },
    cargoTypeIdFun() {
      if (this.formDate.cargoTypeId == 2) {
        this.resetCarTwos();
      }
    },
    getRawContractsByRawIdFun() {
      this.cplistArr.forEach((e) => {
        e.contractId = ''
        e.contractNo = ''
        e.productName = ''
        e.brand = ''
        e.specification = ''
      })
    },
    pouringMethodNameChangeItem(e, k) {
      let type = false
      this.carThreesArr.findIndex((v, index) => {
        if (v.pouringMethodId == e.pouringMethodId && k != index) {
          type = true
        }
      })
      if (type) {
        this.$message({
          message: '该浇筑方式已存在！',
          type: 'warning'
        });
        e.pouringMethodId = ''
        return
      }
      let item = this.pouringMethodIdList.find((res) => res.id == e.pouringMethodId);
      e.pouringMethodName = item.itemName;
      e.type = item.type;
    },
    carThreesArrAdd() {
      let data = {
        id: "",
        pouringMethodId: "",    //浇筑方式id
        pouringMethodName: "",    //浇筑方式
        unitPrice: 0, //单价
        type: 1    //1新增；2修改 0删除
      }
      this.carThreesArr.push(data);
    },
    carThreesArrDel(index) {
      this.carThreesArr.splice(index, 1);
    },
    addJsonList() {
      //价格区间添加
      let index = this.tabsArr[Number(this.editableTabsValue)].list.length - 1
      this.tabsArr[Number(this.editableTabsValue)].list[index].size = index + 1
      this.tabsArr[Number(this.editableTabsValue)].list.splice(index, 0, {
        id: "",
        minDistance: 0,
        singleMinDistance: this.tabsArr[Number(this.editableTabsValue)].list[index].singleMinDistance, //最小距离
        maxDistance: 0,
        singleMaxDistance: this.tabsArr[Number(this.editableTabsValue)].list[index].singleMinDistance, //最大距离
        price: 0,
        singleDistancePrice: 0, //价格
        lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
        coefficient: 0,//运输系数
        type: 1, //1新增；2修改 0删除
        size: index
      });
      this.$forceUpdate();
    },
    addJson() {
      //价格区间添加
      this.carTwosArr.splice(this.carTwosArr.length - 1, 0, {
        id: "",
        minDistance: 0,
        singleMinDistance: 0, //最小距离
        maxDistance: 0,
        singleMaxDistance: this.carTwosArr[this.carTwosArr.length - 1].singleMinDistance, //最大距离
        price: 0,
        singleDistancePrice: 0, //价格
        lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
        coefficient: 0,//运输系数
        type: 1, //1新增；2修改 0删除
      });
      this.$forceUpdate();
    },
    delJsonList(k) {
      //价格区间删除
      let index = this.tabsArr[Number(this.editableTabsValue)].list.length - 1
      this.tabsArr[Number(this.editableTabsValue)].list[index].size = index - 1
      this.tabsArr[Number(this.editableTabsValue)].list[k].size = 0
      this.tabsArr[Number(this.editableTabsValue)].list.splice(k, 1);
      this.$forceUpdate();
    },
    delJson(k) {
      //价格区间删除
      this.carTwosArr.splice(k, 1);
      this.$forceUpdate();
    },
    contractId_contractNoFun(id, k) {
      this.cplistArr[k].contractNo = this.$fromatTable(
        this.contractIdArr,
        id,
        "id",
        "contractNumber"
      );
    },
    stationId_NameFun(k, id) {
      //站点选择后赋值name名
      this.formDate.carVo.list[k].station = this.$fromatTable(
        this.sitelist,
        id,
        "id",
        "name"
      );
      this.$forceUpdate();
    },
    processModelFun() {
      this.formDate.business = [];
    },
    //获取已选择站点名称的业务点
    async stationsControlPointFun(type) {
      if (this.formDate.stationsList.length == 0) {
        this.$message({
          message: '请先选择站点！',
          type: 'warning'
        });
        return
      }
      if (this.formDate.processModel == undefined) {
        this.$message({
          message: '请先选择流程模式！',
          type: 'warning'
        });
        return
      }
      await getDicsType({
        codes: "collaboration,nomarket,personaluse,market",
      }).then((res) => {
        this.businessCheckbox = [];
        res.data.market.items.forEach((v) => {
          this.businessCheckbox.push(v);
        });
        if (!type) {
          this.controlPoint_Dialog = true;
          if (!this.formDate.id && this.formDate.processModel == 0) {
            processes_collection(this.formDate.stationsList).then((res2) => {
              if (res2.data ?.length > 0) {
                this.formDate.business = res2.data.filter((dataRes) => this.businessCheckbox.some((box) => box.id == dataRes))
              }
            })
          }
        }
      });
    },
    //选择甲方公司后显示对应站点名称
    companylistChangeFun(type, companyId) {
      if (type) {
        this.tabsArr = []
        this.formDate.stationsList = []
        this.cplistArr = []
        this.formDate.stations = ''
        if (this.formDate.carVo.list) {
          this.formDate.carVo.list.forEach((v) => {
            v.station = "";
            v.stationId = "";
          });
        }
      }
      this.sitelist = this.companylist.find((res) => res.value == companyId).children
    },
    //调用父级init
    init() {
      this.$emit("sumbit");
    },
    initt(data) {
      /*重置数据*/
      this.tableParam = data;
      this.gettableData();
    },
    srarch(data) {
      this.tableParam = data;
      this.gettableData();
    },
    //主合同单位选择后，带出对应参数
    async changemainCompanyId(e) {
      let item = this.supplierList.find((res) => res.id == e);
      this.formDate.supplierType = item.typeName;
      this.formDate.supplierTypeId = item.typeId;
    },
    /*添加保存*/
    pagessubmitFromDate() {
      this.$refs.reffromDate.validate((valid) => {
        if (valid) {
          if (this.formDate.cargoTypeId == 1 || this.formDate.cargoTypeId == 2) {
            /**判断区间范围是否正确--开始 */
            let type1 = false, text = '';
            if (this.formDate.cargoTypeId == 2) {
              this.tabsArr.forEach((v) => {
                let text0 = v.stationName
                v.list.forEach((v2, k2) => {
                  if (k2 != 0 && v2.singleMinDistance == 0) {
                    text = text0
                    type1 = true
                  }
                })
              })
            }
            /**判断区间范围是否正确--结束 */
            if (type1) {
              this.$message({
                message: text + '：区间值范围不正确，请检查！',
                type: 'warning'
              });
              return
            }
            //业务点数据重组-开始
            if (this.formDate.business.length > 0 || this.formDate.business != '[]') {
              let arr = [];
              this.formDate.business.forEach((v) => {
                this.businessCheckbox.forEach((v2) => {
                  if (v == v2.id) {
                    arr.push({
                      id: v,
                      name: v2.itemName,
                    });
                  }
                });
              });
              this.formDate.business = arr;
            }
            if (this.formDate.business ?.length > 0) {
              this.formDate.business = JSON.stringify(this.formDate.business);
            } else {
              this.formDate.business = "";
            }
            //业务点数据重组-结束
          }
          if (this.formDate.cargoTypeId == 1) {
            //原物料合同表格数据重组-开始
            if (
              this.cplistArr ?.length > 0 &&
                this.formDate.carVo.mlist ?.length > 0
            ) {
              this.formDate.carVo.mlist.forEach((v, k) => {
                let result = this.cplistArr.some((item) => {
                  if (item.fzyId == v.fzyId) {
                    return true;
                  }
                });
                if (!result) {
                  this.formDate.carVo.mlist[k].list.forEach((v) => {
                    v.type = 0;
                  });
                }
              });
              let arr1_1 = [];
              //第一层对比开始,通过第一层自定义字段fzyId对比
              let alldata = this.cplistArr.filter((res) =>
                this.formDate.carVo.mlist.some(
                  (item) => res.fzyId == item.fzyId
                )
              );
              let deleteData = this.formDate.carVo.mlist.filter(
                (res) => !alldata.some((item) => res.fzyId == item.fzyId)
              );
              let addData = this.cplistArr.filter(
                //新增的默认写死为 1；1
                (res) => !alldata.some((item) => res.fzyId == item.fzyId)
              );
              arr1_1 = [...alldata, ...deleteData, ...addData];
              arr1_1.forEach((v, k) => {
                this.formDate.carVo.mlist.forEach((v2) => {
                  if (v.fzyId == v2.fzyId) {
                    let alldata2 = v.list.filter((res) =>
                      v2.list.some((item) => res.id == item.id)
                    );
                    alldata2.forEach((res) => {
                      if (res.type != 0 && res.type != 1) {
                        res.type = 2; //2是修改
                      }
                    });
                    let deleteData2 = v2.list.filter(
                      (res) => !alldata2.some((item) => res.id == item.id)
                    );
                    deleteData2.forEach((res) => {
                      res.type = 0; //0是删除
                    });
                    let addData2 = v.list.filter(
                      //新增的默认写死为 1；1
                      (res) => !alldata2.some((item) => res.id == item.id)
                    );
                    arr1_1[k].list = [...alldata2, ...deleteData2, ...addData2];
                  }
                });
              });
              this.formDate.carVo.mlist = arr1_1;
              //对比结束
            } else {
              this.formDate.carVo.mlist = this.cplistArr;
            }
            //站点数据重装-开始
            let arr = [];
            let type1 = false;
            if ([...new Set(this.formDate.carVo.list.map((item) => item.stationId))] ?.length < this.formDate.carVo.list ?.length) {
              this.$message.warning('站点不能重复');
              return;
            }
            this.formDate.carVo.list
            this.formDate.carVo.list.forEach((v) => {
              this.sitelist.forEach((v2) => {
                if (v.stationId == '') {
                  type1 = true
                }
                if (v.stationId == v2.value) {
                  arr.push({
                    id: v2.value,
                    name: v2.label,
                  });
                }
              });
            });
            if (type1) {
              this.$message({
                message: '请选择站点！',
                type: 'warning'
              });
              return
            }
            let type2 = false
            this.cplistArr.forEach((v) => {
              if (v.contractNo == '') {
                type2 = true
              }
            })
            if (this.cplistArr ?.length == 0 || type2) {
              this.$message({
                message: '请添加原物料合同！',
                type: 'warning'
              });
              return
            }
            let type = false
            this.cplistArr.forEach((v) => {
              if (!v.contractId || !v.startAddress) {
                type = true
              }
            })
            if (type) {
              this.$message({
                message: '请检查表格数据是否完整！',
                type: 'warning'
              });
              return
            }
            this.formDate.stations = arr;
            //站点数据重装-结束
            this.formDate.stations = JSON.stringify(this.formDate.stations);
            //供应产品数据重组-结束
          } else if (this.formDate.cargoTypeId == 2) {
            //站点数据重装-开始
            if (this.formDate.stationsList ?.length > 0) {
              let arr = [];
              this.formDate.stationsList.forEach((v) => {
                this.sitelist.forEach((v2) => {
                  if (v == v2.value) {
                    arr.push({
                      id: v,
                      name: v2.label,
                    });
                  }
                });
              });
              this.formDate.stations = arr;
            }
            this.formDate.stations = JSON.stringify(this.formDate.stations);
            //站点数据重装-结束
            this.carVo = [];
            //站点区间价数据重组-开始---------------------------------------------------------------
            if (this.tabsArr ?.length > 0 && this.formDate.carTwos ?.length > 0) {
              let arr1_1 = [];
              //第一层对比开始,通过第一层自定义字段fzyId对比
              let alldata = this.tabsArr.filter((res) =>
                this.formDate.carTwos.some((item) => res.stationId == item.stationId)
              );
              let deleteData = this.formDate.carTwos.filter(
                (res) => !alldata.some((item) => res.stationId == item.stationId)
              );
              deleteData.forEach((res) => {
                res.type = 0; //0是删除
              });
              let addData = this.tabsArr.filter(
                (res) => !alldata.some((item) => res.stationId == item.stationId)
              );
              arr1_1 = [...alldata, ...deleteData, ...addData];
              arr1_1.forEach((v, k) => {
                this.formDate.carTwos.forEach((v2) => {
                  if (v.type != 0 && v.stationId == v2.stationId) {
                    let alldata2 = v.list.filter((res) =>
                      v2.list.some((item) => res.id == item.id)
                    );
                    alldata2.forEach((res) => {
                      res.type = 2; //2是修改
                    });
                    let deleteData2 = v2.list.filter(
                      (res) => !alldata2.some((item) => res.id == item.id)
                    );
                    deleteData2.forEach((res) => {
                      res.type = 0; //0是删除
                    });
                    let addData2 = v.list.filter(
                      (res) => !alldata2.some((item) => res.id == item.id)
                    );
                    arr1_1[k].list = [...alldata2, ...deleteData2, ...addData2];
                    arr1_1[k].list.sort((a, b) => {//根据条件排序
                      if (a.size < b.size) {
                        return -1;
                      } else if (a.size == b.size) {
                        return 0;
                      } else {
                        return 1;
                      }
                    });
                  } else if (v.type == 0) {
                    v.list.forEach((v3) => {
                      v3.type = 0
                    })
                  }
                });
              });
              this.formDate.carTwos = arr1_1;
            } else {
              this.formDate.carTwos = this.tabsArr
            }

            //站点区间价数据重组-结束
            //浇筑方式数据重组-开始
            let alldata2 = this.carThreesArr.filter((res) =>
              this.formDate.carThrees.some((item) => res.id == item.id)
            );
            alldata2.forEach((res) => {
              res.type = 2; //2是修改
            });
            let deleteData2 = this.formDate.carThrees.filter(
              (res) => !alldata2.some((item) => res.id == item.id)
            );
            deleteData2.forEach((res) => {
              res.type = 0; //0是删除
            });
            let addData2 = this.carThreesArr.filter(
              //新增的默认写死为 1；1
              (res) => !alldata2.some((item) => res.id == item.id)
            );
            this.formDate.carThrees = [...alldata2, ...deleteData2, ...addData2];
            //浇筑方式数据重组-结束
            let type = false
            this.carThreesArr.forEach((v) => {
              if (!v.pouringMethodId) {
                type = true
              }
            })
            if (type) {
              this.$message({
                message: '请检查表格数据是否完整！',
                type: 'warning'
              });
              return
            }
          } else if (this.formDate.cargoTypeId == 3) {
            this.formDate.business = "";
            this.formDate.stations = ''
          }
          this.formDate.cargoType = this.$fromatTable(
            this.cargoTypeIdArr,
            this.formDate.cargoTypeId,
            "id",
            "name"
          );
          this.formDate.supplierName = this.$fromatTable(
            this.supplierList,
            this.formDate.supplierId,
            "id",
            "name"
          );
          this.formDate.supplierTypeId = this.$fromatTable(
            this.supplierList,
            this.formDate.supplierId,
            "id",
            "typeId"
          );
          this.formDate.clearingSource = this.$fromatTable(
            this.theUnitPriceSource,
            this.formDate.clearingSourceId,
            "id",
            "itemName"
          );
          this.formDate.clearingForm = this.$fromatTable(
            this.clearingFromIdList,
            this.formDate.clearingFormId,
            "id",
            "name"
          );
          this.formDate.cooperationClass = this.$fromatTable(
            this.supplierList,
            this.formDate.supplierId,
            "id",
            "gradeName"
          );
          this.formDate.cooperationClassId = this.$fromatTable(
            this.supplierList,
            this.formDate.supplierId,
            "id",
            "gradeId"
          );
          this.formDate.accessory = JSON.stringify(this.files);
          contractSaveOrUpdate(this.formDate).then((res) => {
            if (res.code == 1001) {
              this.addDialog = false;
              this.$message.success('操作成功');
              this.init();
            }
          });
        } else {
          return false;
        }
      });
    },
    //获取合同详情----------------------------------------------------------------------------
    contractQueryDetailByIdFun(d) {
      this.tabsArr = []
      if (this.$refs.reffromDate) {
        this.$refs.reffromDate.resetFields();
      }
      this.addDialog = true;
      this.modifyType = true;
      this.cplistArr = [];
      contractQueryDetailById({ id: d }).then(async (res) => {
        this.formDate = { ...this.formDate, ...res.data.contract };
        this.changemainCompanyId(this.formDate.supplierId, true)
        this.formDate.startDayendDay = [];
        this.formDate.startDayendDay[0] = this.formDate.startDay;
        this.formDate.startDayendDay[1] = this.formDate.endDay;
        this.files = JSON.parse(this.formDate.accessory) || [];
        if (this.formDate.cargoTypeId == 1 || this.formDate.cargoTypeId == 2) {
          let arr1 = [];
          JSON.parse(this.formDate.stations).forEach((v) => {
            arr1.push(v.id);
          });
          this.formDate.stationsList = arr1;
          if (this.formDate.business) {
            let arr2 = [];
            JSON.parse(this.formDate.business).forEach((v) => {
              arr2.push(v.id);
            });
            this.formDate.business = arr2;
          } else {
            this.formDate.business = [];
          }
        }
        if (this.formDate.cargoTypeId == 1) {
          this.formDate.carVo = {};
          if (res.data.list.list.length > 0) {
            this.formDate.carVo.list = this.copy(res.data.list.list);
          } else {
            this.formDate.carVo.list = [
              {
                station: "",
                stationId: "",
                type: 1, //1新增 2修改 0删除
              },
            ]
          }
          let listArr = res.data.list.mlist;
          listArr.forEach((v, k) => {
            v.fzyId = k;
          });
          this.formDate.carVo.mlist = this.copy(listArr);
          this.cplistArr = this.copy(listArr);
          this.cplistArrSizeY()
          this.resetCarTwos();
        } else if (this.formDate.cargoTypeId == 2) {
          this.formDate.carTwos = this.copy(res.data.list);//站点价格区间
          this.formDate.carTwos.forEach((v) => {
            v.list.map((v2, k2) => {
              v2.size = k2
            })
          })
          this.tabsArr = this.copy(res.data.list)//站点价格区间
          this.tabsArr.forEach((v) => {
            v.list.map((v2, k2) => {
              v2.size = k2
            })
          })
          this.editableTabsValue = '0'
          this.formDate.carThrees = this.copy(res.data.carThreeList);
          this.carThreesArr = this.copy(res.data.carThreeList)
          this.$forceUpdate();
          this.resetCarVo();
        } else if (this.formDate.cargoTypeId == 3) {
          this.formDate.business = [];
          this.resetCarTwos();
          this.resetCarVo();
        }
        this.companylistChangeFun(false, this.formDate.firstPartyId); //选择甲方公司后显示对应站点名称
        //判断公司-站点权限是否包含返回的详情id值，在就回显，不在就回显提示信息placeholder
        let type1 = this.companylist.findIndex((res) => res.value == this.formDate.firstPartyId)
        if (type1 == -1) {
          this.formDate.firstPartyId = ''
          this.formDate.firstPartyIdPlaceholder = this.formDate.firstParty
        }
        await this.stationsControlPointFun(true); //获取已选择站点名称的业务点
        this.$forceUpdate();
      });
    },
    //调价列表
    riseInPriceQueryOneByidFun(row) {
      this.contractId = row.id;
      this.riseInPriceQueryOneByidType = true;
      this.modifyType = false
      if (row.cargoTypeId == 1) {
        contractQueryDetailById({ id: row.id }).then(async (res) => {
          this.formDate = res.data.contract;
          this.formDate.carVo = {};
          this.formDate.carVo.list = this.copy(res.data.list.list);
          this.cplistArr = this.copy(res.data.list.mlist);
          this.companylistChangeFun(false, this.formDate.firstPartyId); //选择甲方公司后显示对应站
          this.$forceUpdate()
        });
      } else if (row.cargoTypeId == 2) {
        queryStationsByID({ id: row.id }).then(async (res) => {
          this.formDate.cargoTypeId = 2
          this.tabsArr = res.data
        });
      }
    },
    //价格设置-调价详情-列表
    QueryOneByidFun(d, moneyType) {
      this.moneyType = false
      if (moneyType) {
        this.moneyType = true
      }
      this.QueryOneByidType = true;
      this.QueryOneByidArr = [];
      this.contractRawMoneySaveForm.startTime = "";
      this.QueryOneByidObject.contractId = this.contractId;
      if (this.moneyType) {//混凝土
        this.QueryOneByidObject.contractFacility = 1;
        this.QueryOneByidObject.stationId = d;
        QueryPageBystationId(this.QueryOneByidObject).then((res) => {
          this.QueryOneByidArr = res.data;
        });
        /**查询信息给条件设置初始值 */
        contractQueryDetailById({ id: this.contractId }).then(async (res) => {
          this.carTwosArr = []
          let listArr = res.data.list.find((res) => res.stationId == this.QueryOneByidObject.stationId)
          listArr.list.forEach((v) => {
            let json = {
              minDistance: v.singleMinDistance,
              maxDistance: v.singleMaxDistance,
              price: v.singleDistancePrice,
              addDistance: v.addDistance
            }
            this.carTwosArr.push(json)
          })
        })
      } else {//原物料
        this.QueryOneByidObject.rawId = d;
        QueryOneByid(this.QueryOneByidObject).then((res) => {
          this.QueryOneByidArr = res.data.data;
          this.QueryOneByidObject.total = res.data.totalRows;
        });
      }
    },
    /**调价的添加 */
    contractRawMoneySaveFun() {
      if(!this.files2?.length) {
        return this.$message.warning("请上传附件文件")
      }
      this.$refs.contractRawMoneySaveForm.validate((valid) => {
        if (valid) {
          this.contractRawMoneySaveForm.contractId = this.contractId;
          this.contractRawMoneySaveForm.rawId = this.QueryOneByidObject.rawId;
          this.contractRawMoneySaveForm.contractFacility = this.QueryOneByidObject.rawId;
          this.contractRawMoneySaveForm.filePaths = JSON.stringify(this.files2);
          if (this.moneyType) {
            /**判断区间范围是否正确--开始 */
            let type1 = false
            let arr1 = this.carTwosArr
            arr1.forEach((v, k) => {
              if (k > 0 && v.minDistance - arr1[k - 1].minDistance <= 0) {
                type1 = true
              }
            })
            /**判断区间范围是否正确--结束 */
            if (type1) {
              this.$message({
                message: '区间值范围不正确，请检查！',
                type: 'warning'
              });
            } else {
              //合同类型-泵管的价格用
              this.contractRawMoneySaveForm.list = this.carTwosArr;
              this.contractRawMoneySaveForm.contractFacility = 1
              this.contractRawMoneySaveForm.stationId = this.QueryOneByidObject.stationId
              PumpPriceLogSave(this.contractRawMoneySaveForm).then((res) => {
                if (res.code == 1001) {
                  this.QueryOneByidFun(this.QueryOneByidObject.stationId, true);
                }
              });
            }
          } else {
            contractRawMoneySave(this.contractRawMoneySaveForm).then((res) => {
              if (res.code == 1001) {
                this.QueryOneByidFun();
              }
            });
          }
        } else {
          return false;
        }
      });
    },
    contractRawMoneyDeletesFun(d) {
      if (this.moneyType) {
        let obj = {
          contractId: this.contractId,
          contractFacility: d.contractFacility,
          startTime: d.startTime,
        };
        PumpPriceLogDeletes(obj).then(() => {
          this.QueryOneByidFun(this.QueryOneByidObject.stationId, true);
        });
      } else {
        contractRawMoneyDeletes({ id: d.id }).then(() => {
          this.QueryOneByidObject.page = 1
          this.QueryOneByidFun();
        });
      }
    },
    basePriceListFun2(d) {
      this.basePriceListType2 = true;
      let obj = {
        contractId: d.contractId,
        contractFacility: d.contractFacility,
        startTime: d.startTime,
      };
      PumpPriceLogGetDetail(obj).then((res) => {
        if (res.code == 1001) {
          this.carTwosArr2 = res.data;
        }
      });
    },
    //协作单位组合
    queryListsByPidFun(d) {
      this.contractId = d.id;
      this.AllqueryListsByPid = true;
      queryListsByPid({ supplierId: d.supplierId }).then((res) => {
        this.queryListsByPidArr = res.data;
        // let obj = {
        //   id: d.supplierId,
        //   name: d.supplierName,
        // };
        // this.queryListsByPidArr.splice(0, 0, obj);
      });
    },
    //开户信息详情
    contractAccountGetDetailFun(d) {
      this.contractAccountSaveForm = {}
      this.contractAccountGetDetailType = true;
      let obj = {
        contractId: d.id,
        pid: d.supplierId,
        type: 1,
      };
      contractAccountGetDetail(obj).then((res) => {
        this.contractAccountSaveForm = res.data;
        this.$refs.contractAccountSaveForm.resetFields();
      });
    },
    //开户信息保存
    contractAccountSaveFun() {
      this.$refs.contractAccountSaveForm.validate((valid) => {
        if (valid) {
          // this.formDate.contractPact = this.$fromatTable(
          //   this.contractPactIdArr,//未知
          //   this.formDate.contractPactId,
          //   "id",
          //   "name"
          // );
          contractAccountSave(this.contractAccountSaveForm).then((res) => {
            if (res.code == 1001) {
              this.contractAccountGetDetailType = false;
            }
          });
        } else {
          return false;
        }
      });
    },
    //重置表格-渲染
    reset() {
      this.tabsArr = []
      this.modifyType = false;
      this.formDate = {
        companyId: '',
        stationId: '',
        stationsList: [],
        startDayendDay: [],
        id: "",
        contractTypeId: "2",
        contractType: "车辆租赁",
        firstParty: "", //甲方
        supplierName: "", //供应商
        supplierTypeId: "", //供应商类型id
        userId: "",
        userName: "",
        clearingSource: "", //结算原
        clearingForm: "", //结算方式
        accessory: [], //附件
        cooperationClass: "", //甲方公司里面出来的
        cooperationClassId: "", //甲方公司里面出来的
        business: [], //业务点1，2，3
        cargoTypeId: 1, //货物类型
        carThrees: [],
        carTwos: [],
        carVo: {
          //自定义表头
          list: [
            {
              station: "",
              stationId: "",
              type: 1, //1新增 2修改 0删除
            },
          ],
          //表格内容
          mlist: [],
        },
      };
      this.cplistArr = [];
      this.businessCheckbox = [];
      this.carTwosArr = [
        {
          id: "",
          singleMinDistance: 0, //最小距离
          singleMaxDistance: 1, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          type: 1, //1新增；2修改 0删除
        },
        {
          id: "",
          singleMinDistance: 1, //最小距离
          singleMaxDistance: 2, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          type: 1, //1新增；2修改 0删除
        },
        {
          id: "",
          singleMinDistance: 2, //最小距离
          singleMaxDistance: 9999999, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          addDistance: 0,//每增加
          type: 1, //1新增；2修改 0删除
          isLastOne: 1,//最后一条
        },
      ];
      this.files = [];
    },
    //重置表格-渲染
    resetCarTwos() {
      this.formDate.carThrees = []
      this.carTwosArr = [
        {
          id: "",
          singleMinDistance: 0, //最小距离
          singleMaxDistance: 1, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          type: 1, //1新增；2修改 0删除
        },
        {
          id: "",
          singleMinDistance: 1, //最小距离
          singleMaxDistance: 2, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          type: 1, //1新增；2修改 0删除
        },
        {
          id: "",
          singleMinDistance: 2, //最小距离
          singleMaxDistance: 9999999, //最大距离
          singleDistancePrice: 0, //价格
          lastDistancePrice: 0,//上一个区间价格(第一个区间为0)
          coefficient: 0,//运输系数
          addDistance: 0,//每增加
          type: 1, //1新增；2修改 0删除
          isLastOne: 1,//最后一条
        },
      ];
      this.$forceUpdate();
      return this.carTwosArr
    },
    //重置表格-渲染
    resetCarVo() {
      this.formDate.carVo = {
        //自定义表头
        list: [
          {
            station: "",
            stationId: "",
            type: 1, //1新增 2修改 0删除
          },
        ],
        //表格内容
        mlist: [],
      };
    },
    /**合同编号是否重复 */
    queryContractNumberFun() {
      queryContractNumber({ contractNumber: this.formDate.contractNumber, id: this.formDate.id }).then((res) => {
        if (res.code == 1001 && !res.data) {
          this.$message({
            message: '合同编号重复！',
            type: 'warning'
          });
          this.formDate.contractNumber = ''
        }
      })
    },
    /**单选列表打开 */
    async ListChoiceTypeFun(index, id) {
      if (!this.formDate.firstPartyId) {
        this.$message({
          message: '请先选择甲方公司！',
          type: 'warning'
        });
        return
      }
      if (this.formDate.cargoTypeId === 1 && !this.formDate.cargoId) {
        this.$message({
          message: '请选择运输货物',
          type: 'warning'
        });
        return
      }
      await this.ListChoicePagingFun();
      this.ListChoiceType = true
      this.ListChoiceDataIndex = index//点击的合同-选择的数据表格scope.$index
      if (id) {
        this.ListChoiceRadio = id//合同id
        this.ListChoiceRadioCopy = id
        this.ListChoiceRadioRow = this.ListChoiceData.find((res) => res.id == id)
        await this.contractProductgetListByPidFun(id)
        let arr1 = this.cplistArr.filter((res) => res.contractId == id)
        let arr2 = []
        arr1.forEach((v) => {
          arr2.push(v.rawId)
        })
        this.ListChoiceData2.forEach((v) => {
          if (arr2.findIndex((r) => r == v.productId) != -1) {
            this.productSelectionList.push(v)
            this.$refs.ListChoiceData2.toggleRowSelection(v);
          }
        })
      } else {
        this.ListChoiceRadio = ''
        this.ListChoiceRadioCopy = ''
      }
    },
    //单选选中
    ListChoiceFun(currentRow) {
      if (currentRow) {
        let type = this.cplistArr.findIndex((res) => res.contractId == currentRow.id)
        if (type == -1 || this.ListChoiceRadioCopy == currentRow.id) {
          this.ListChoiceRadio = currentRow.id
          this.ListChoiceRadioRow = currentRow
          this.contractProductgetListByPidFun(currentRow.id)
        } else {
          this.$message({
            message: '该选项已被选择！',
            type: 'warning'
          });
          setTimeout(() => {
            this.ListChoiceRadioRow = ''
          }, 100);
        }
      }
    },
    //合同的原物料查询list
    async contractProductgetListByPidFun(id) {
      await contractProductgetListByPid({ contractId: id }).then((res) => {
        this.ListChoiceData2 = res.data
      })
    },
    //原物料复选
    productSelection(val) {
      this.productSelectionList = val
    },
    /**保存和校验不重复选中项 */
    ListChoiceAddFun() {
      //原物料选择后对应值【品牌，规格..】带入表格中
      this.ListChoiceType = false;
      let list = [];
      this.formDate.carVo.list.forEach(() => {
        list.push({
          id: "",
          type: "1",
          money: 0,
        });
      });
      const newData = this.productSelectionList.map(item => {
        if (item.productId === this.cplistArr[this.ListChoiceDataIndex].rawId) {
          return {
            ...this.cplistArr[this.ListChoiceDataIndex],
            ontractId: this.ListChoiceRadioRow.id, 
            contractNo: this.ListChoiceRadioRow.contractNumber,
          }
        } else {
          return {
            contractId: this.ListChoiceRadioRow.id,
            contractNo: this.ListChoiceRadioRow.contractNumber,
            startAddress: "", //起运地
            list: list,
            productName: item.productName,//原物料名称
            rawId: item.productId,//原物料id
            brand: item.brand,//货物品牌
            specification: item.specification,//规格
          }
        }
      });
      this.cplistArr = newData;
      this.cplistArrSizeY()
    },
    /**查询原物料合同列表 */
    async ListChoicePagingFun() {
      this.ListChoiceData = [];
      this.ListChoiceData2 = [];
      const params = {
        page: this.serachParams.page,
        pageSize: 10,
        id: this.formDate.cargoId,
        firstPartyId: this.formDate.firstPartyId,
        contractNumber: this.contractNumber,
        supplierName: this.supplierName,
      }
      await getRawContractsByRawId(params).then((res) => {
        if (res.code === 1001) {
          this.ListChoiceData = res.data.data;
          this.serachParams.total = res.data.totalRows;
        }
      });
    },
    serachContract () {
      const params = {
        page: this.serachParams.page,
        pageSize: 10,
        id: this.formDate.cargoId,
        firstPartyId: this.formDate.firstPartyId,
        contractNumber: this.contractNumber,
        supplierName: this.supplierName,
      }
      getRawContractsByRawId(params).then((res) => {
        if (res.code === 1001) {
          this.ListChoiceData = res.data.data;
          this.serachParams.total = res.data.totalRows;
        }
      });
    },
    //表格的添加
    addItem() {
      //增加到岸价格地表格数据
      let list = [];
      this.formDate.carVo.list.forEach(() => {
        list.push({
          id: "",
          type: "1",
          money: 0,
        });
      });
      let data = {
        sizeY: 1,
        contractId: "", //合同id
        contractNo: "", //合同编号
        startAddress: "", //起运地
        list: list,
        productName: '',//原物料名称
        brand: '',//货物品牌
        specification: '',//规格
      };
      this.cplistArr.push(data);
      this.$forceUpdate();
    },
    //表格的删除
    deleteItem(index) {
      //删除到岸价格地表格数据
      this.cplistArr.splice(index, 1);
      this.cplistArrSizeY()
    },
    //站点的添加
    addHeader(k) {
      //添加到岸价格地表格头部
      let obj = {
        station: "", //站点
        stationId: "", //站点id
        type: 1, //1新增 2修改 0删除
      };
      this.formDate.carVo.list.splice(k + 1, 0, obj);
      this.cplistArr.forEach((v) => {
        v.list.splice(k + 1, 0, {
          id: "",
          type: "1",
          money: 0,
        });
      });
      this.$forceUpdate();
    },
    //站点的删除
    delHeader(k) {
      //删除到岸价格地表格头部
      this.formDate.carVo.list.splice(k, 1);
      this.cplistArr.forEach((v) => {
        v.list.splice(k, 1);
      });
      this.$forceUpdate();
    },
    /**区间填入值不能小于等于前一个大于等于后一个 */
    inpuSizeCheck(val, k, arr) {
      arr[k+1].singleMinDistance = val;
      let frontNumber = '', afterNumber = '';
      let l = k - 1
      for (l; l >= 0; l--) {
        frontNumber = arr[l].singleMinDistance
        break
      }
      let i = k + 1
      if (i == arr.length-1) {
        afterNumber = 9999999
      } else {
        for (i; i < arr.length; i++) {
          afterNumber = arr[i].singleMinDistance
          break
        }
      }
      if (val - frontNumber <= 0) {
        this.$message({
          message: '区间值范围不正确，请检查！',
          type: 'warning'
        });
      } else if (arr[k+1].singleMaxDistance < afterNumber) {
        this.$message({
          message: '区间值范围不正确，请检查！',
          type: 'warning'
        });
      }
    },
    /**区间填入值不能小于等于前一个大于等于后一个 */
    inpuSizeCheck2(val, k, arr) {
      let frontNumber = '', afterNumber = '';
      let l = k - 1
      for (l; l >= 0; l--) {
        frontNumber = arr[l].minDistance
        break
      }
      let i = k + 1
      if (i == arr.length) {
        afterNumber = 9999999
      } else {
        for (i; i < arr.length; i++) {
          afterNumber = arr[i].minDistance
          break
        }
      }
      if (val - frontNumber <= 0) {
        this.$message({
          message: '区间值范围不正确，请检查！',
          type: 'warning'
        });
      } else if (afterNumber - val <= 0) {
        this.$message({
          message: '区间值范围不正确，请检查！',
          type: 'warning'
        });
      }
    },
    /**计算合并列的长度 */
    cplistArrSizeY() {
      let id = '';
      this.cplistArr.forEach((v) => {
        if (v.contractId && id != v.contractId) {
          id = v.contractId
          let sizeY = this.cplistArr.filter((res) => res.contractId == id).length
          v.sizeY = sizeY
        } else if (v.contractId) {
          v.sizeY = 0
        }
      })
    },
    //合并列
    objectSpanMethod({ row, columnIndex }) {
      /**第一列的合并：rowspan是合并列数量，colspan是合并行的数量 */
      if (columnIndex == 0) {
        return [row.sizeY, 1]
      } else {
        return [1, 1]
      }
    },
    sizeChange(value) {
      this.tableParam.pageSize = value;
      this.gettableData();
    },
  },
  filters: {
    //价格设置，是否显示价格输入框，对应价格区间显示
    moneyFun(moneyType) {
      if (moneyType) {
        return true;
      } else {
        return false;
      }
    },
    //站点list表格中拼接展示
    stationsFun(arr) {
      if (arr.indexOf('[') != 0) {//处理老数据异常站点数据报错
        arr = '[]'
      }
      if (arr) {
        let ket = JSON.parse(arr).map((res) => {
          return res.name;
        });
        return ket.join(",");
      } else {
        return "";
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.car {
  .table_link {
    margin-left: 10px;
    color: $bg_color;
  }
  .table_link:hover {
    opacity: 0.8;
  }
  .form-title {
    font-size: 18px;
    margin: 10px 0;
  }
  .FZYguanKongYeWuDian {
    display: flex;
    > table {
      flex: none;
      width: 100px;
    }
    > div {
      flex: 1;
    }
  }
  .FZY1-3 {
    border-bottom: 1px solid #f2f2f2;
    .el-input-number--mini {
      width: 80px;
    }
    .liBox1,
    .liBox2 {
      padding: 10px;
      width: 790px;
      display: flex;
      > div:nth-of-type(1) {
        width: 210px;
      }
      > div:nth-of-type(2) {
        width: 216px;
      }
      span {
        display: inline-block;
        margin-left: 20px;
      }
      .el-input-number ::v-deep {
        margin-left: 20px;
      }
    }
    .liBox2 {
      > div:nth-of-type(2) {
        width: 470px;
      }
    }
    .liBox3 {
      padding: 10px;
      width: 820px;
      display: flex;
      > div:nth-of-type(1) {
        display: flex;
        > div:nth-of-type(1) {
          width: 210px;
          span {
            margin-left: 10px;
          }
          .el-input-number ::v-deep {
            margin-left: 10px;
            width: 80px;
          }
        }
        span {
          display: inline-block;
          margin-left: 20px;
        }
        .el-input-number ::v-deep {
          margin-left: 20px;
        }
      }
      > div:nth-of-type(2) {
        width: 130px;
        flex: none;
        line-height: 28px;
        padding-left: 20px;
      }
    }
  }
  .FZYcheckbox {
    .el-checkbox {
      min-width: 155px;
      margin-right: 0px;
    }
  }
  .FZYform {
    .el-form-item {
      min-width: 445px;
      .el-input,
      .el-select {
        width: 340px;
      }
      .hyyc {
        width: 310px;
        .el-input {
          width: 310px;
        }
      }
    }
  }
  .FZYform2 {
    .el-form-item__error {
      white-space: nowrap;
    }
  }
  .FZYselectList {
    .el-select {
      width: 135px !important;
      margin-right: 10px;
    }
  }
  .fzyDivFlex {
    display: flex;
    height: 550px;
    > div {
      flex: 1;
    }
  }
}
</style>
<style lang="scss">
.car {
  .FZYform {
    padding-top: 0px !important;
  }
}
</style>